package com.gzx.plugin.tjzy.feign.gzxcase.controller;

import com.gzx.plugin.tjzy.feign.gzxcase.service.GzxCaseFeignService;
import com.gzx.tjzy.feign.req.gzxcase.GzxCaseDetailReqDto;
import com.gzx.tjzy.feign.req.gzxcase.GzxCaseReqDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zjt
 * @description
 * @date 2025/2/13 10:04
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/feign/tjzy/case")
public class GzxCaseFeignController {

    private final GzxCaseFeignService caseFeignService;

    /**
     * 案件主表数据同步
     *
     * @param caseReqDtoList
     */
    @RequestMapping("/sync")
    public void caseSync(@RequestBody List<GzxCaseReqDto> caseReqDtoList) {
        log.info("案件主表数据同步开始......{}", caseReqDtoList);
        caseFeignService.insertBatchCase(caseReqDtoList);
    }

    /**
     * 案件详情数据同步
     *
     * @param caseDetailReqDtoList
     */
    @RequestMapping("/detail/sync")
    public void caseDetailSync(@RequestBody List<GzxCaseDetailReqDto> caseDetailReqDtoList) {
        log.info("案件详情数据同步开始......{}", caseDetailReqDtoList);
        caseFeignService.insertBatchCaseDetail(caseDetailReqDtoList);
    }
}
